package czxy.dao;

import czxy.domain.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {

    //根据用户 的 id 查询用户 的全部信息 -- 包括用户本身的信息

    @Select("select * from  user where  uid  = #{uid}")
    @Results( id = "userAllInfo",value = {
            @Result(property = "uid", column = "uid"),
            @Result(property = "orderList", many = @Many(select = "czxy.dao.OrderMapper.findOrdersById"), column = "uid")
    })
    public User findUserAllInfoByUid(@Param("uid") Integer uid);


    //查询所有用户信息

   @Select("select  *  from  user;")
    @ResultMap("userAllInfo")
    public   List<User> findUsersAllInfo();

   //根据uid  查询 user 信息  只包含用户信息

    @Select("select  * from  user where uid =#{uid}")


    public  User findUserByUid(@Param("uid") Integer uid);







}